/* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

iotcloudgateway开通接口
用户开通iotcloudgateway服务相关接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/

#import <Foundation/Foundation.h>
#import <JDCloudOCSDKIotcloudgateway/IotcloudgatewayApiModel.h>


@implementation IotcloudgatewayDescribeInstanceRequest
-(id) initWithRegion:(NSString *)regionId
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.instanceId = instanceId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.version = version;
    self.instanceId = instanceId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    return self;
} 

@end
@implementation IotcloudgatewayQueryInstanceExposeDomainRequest
-(id) initWithRegion:(NSString *)regionId
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.instanceId = instanceId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.version = version;
    self.instanceId = instanceId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    return self;
} 

@end
@implementation IotcloudgatewayDescribeInstancesRequest
-(id) initWithRegion:(NSString *)regionId
pageNumber:(NSNumber*)pageNumber
pageSize:(NSNumber*)pageSize { 
    self.regionId = regionId;
    self.pageNumber = pageNumber;
    self.pageSize = pageSize;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
pageNumber:(NSNumber*)pageNumber
pageSize:(NSNumber*)pageSize { 
    self.regionId = regionId;
    self.version = version;
    self.pageNumber = pageNumber;
    self.pageSize = pageSize;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self pageNumber])
    {
        [result setValue:[self pageNumber] forKey:@"pageNumber"];
    }
    if([self pageSize])
    {
        [result setValue:[self pageSize] forKey:@"pageSize"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.pageNumber = [dictionary objectForKey:@"pageNumber"];
    self.pageSize = [dictionary objectForKey:@"pageSize"];
    return self;
} 

@end
@implementation IotcloudgatewayQueryInstanceStatusResult
-(id) initWithStatus:(NSString*) status { 
    self.status = status;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self status])
    {
        [result setValue:[self status] forKey:@"status"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.status = [dictionary objectForKey:@"status"];
    return self;
} 

@end
@implementation IotcloudgatewayQueryInstanceExposeDomainResult
-(id) initWithIotgwd:(NSString*) iotgwd
        iotgwu:(NSString*)iotgwu { 
    self.iotgwd = iotgwd;               
    self.iotgwu = iotgwu;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self iotgwd])
    {
        [result setValue:[self iotgwd] forKey:@"iotgwd"];
    }
    if([self iotgwu])
    {
        [result setValue:[self iotgwu] forKey:@"iotgwu"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.iotgwd = [dictionary objectForKey:@"iotgwd"];
    self.iotgwu = [dictionary objectForKey:@"iotgwu"];
    return self;
} 

@end
@implementation IotcloudgatewayQueryInstanceStatusRequest
-(id) initWithRegion:(NSString *)regionId
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.instanceId = instanceId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.version = version;
    self.instanceId = instanceId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    return self;
} 

@end
@implementation IotcloudgatewayDeviceControlResult
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    return self;
} 

@end
  
@implementation IotcloudgatewayDeviceControlResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
IotcloudgatewayDeviceControlResult* result = [[IotcloudgatewayDeviceControlResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(IotcloudgatewayDeviceControlResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
  
@implementation IotcloudgatewayQueryInstanceExposeDomainResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
IotcloudgatewayQueryInstanceExposeDomainResult* result = [[IotcloudgatewayQueryInstanceExposeDomainResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(IotcloudgatewayQueryInstanceExposeDomainResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
  
@implementation IotcloudgatewayQueryInstanceStatusResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
IotcloudgatewayQueryInstanceStatusResult* result = [[IotcloudgatewayQueryInstanceStatusResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(IotcloudgatewayQueryInstanceStatusResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation IotcloudgatewayDescribeInstancesResult
-(id) initWithInstances:(NSArray<Instance*>*) instances
        totalCount:(NSNumber*)totalCount { 
    self.instances = instances;               
    self.totalCount = totalCount;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instances])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self instances] count]; i++) {
            Instance* item = [[self instances] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"instances"];
    }
    if([self totalCount])
    {
        [result setValue:[self totalCount] forKey:@"totalCount"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    NSArray* instancesArray = [dictionary objectForKey:@"instances"];
    if(instancesArray&&![instancesArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [instancesArray count];i++)
        {
        Instance* item = [[Instance alloc]initWithDic:[instancesArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.instances = propertyArray;
    }
    self.totalCount = [dictionary objectForKey:@"totalCount"];
    return self;
} 

@end
  
@implementation IotcloudgatewayDescribeInstancesResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
IotcloudgatewayDescribeInstancesResult* result = [[IotcloudgatewayDescribeInstancesResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(IotcloudgatewayDescribeInstancesResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation IotcloudgatewayDescribeInstanceResult
-(id) initWithInstance:(Instance*) instance { 
    self.instance = instance;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instance])
    {
        [result setValue:[[self instance] dictionary]forKey:@"instance"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instance = [[Instance alloc]initWithDic:[dictionary objectForKey:@"instance"]];
    return self;
} 

@end
  
@implementation IotcloudgatewayDescribeInstanceResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
IotcloudgatewayDescribeInstanceResult* result = [[IotcloudgatewayDescribeInstanceResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(IotcloudgatewayDescribeInstanceResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
@implementation IotcloudgatewayDeviceControlRequest
-(id) initWithRegion:(NSString *)regionId
devicecmd:(DeviceControlSpec*)devicecmd
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.devicecmd = devicecmd;
    self.instanceId = instanceId;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
devicecmd:(DeviceControlSpec*)devicecmd
instanceId:(NSString*)instanceId { 
    self.regionId = regionId;
    self.version = version;
    self.devicecmd = devicecmd;
    self.instanceId = instanceId;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self devicecmd])
    {
        [result setValue:[[self devicecmd] dictionary]forKey:@"devicecmd"];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.devicecmd = [[DeviceControlSpec alloc]initWithDic:[dictionary objectForKey:@"devicecmd"]];
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    return self;
} 

@end
 
